package com.job.yangshida.homework0718;

import javax.activation.MailcapCommandMap;
import java.util.Arrays;
import java.util.Random;

/**
 * @author 杨士达
 * @version 1.0
 * @since 2022-07-19 13:38:01
 */
public class Lottery {
    public static int [] lottery=new int[7];
    public static int[] generateLottery() {
        Random random=new Random();
        for (int i=0;i<7;i++){
            int a=1+random.nextInt(33);
            if (!isExist(a)){
                lottery[i]=a;
            }
        }
        return lottery;
    }
    private static boolean isExist(int a){
        for (int i=0;i<7;i++){
            if (a==lottery [i]){
                return true;
            }
        }
        return false;
    }
    public static int count=0;
    public static int getCount() {
        int[] ii={23,31,1,14,17,18,19};
        for (int i=0;i<7;i++){
            for (int j=0;j<7;j++){
                if (ii[i]==lottery[j]){
                    count++;
            }
        }
    }
        return count;
    }
    public static void main(String[] args) {
        for (int i=0;i<5;i++) {
            generateLottery();
            System.out.println(Arrays.toString(lottery));
            getCount();

            switch (count) {
                case 0:
                    System.out.println("没中奖");
                    break;
                case 1:
                    System.out.println("小明6等奖");
                    break;
                case 2:
                    System.out.println("5等奖");
                    break;
                case 3:
                    System.out.println("小明4等奖");
                    break;
                case 4:
                    System.out.println("小明3等奖");
                    break;
                case 5:
                    System.out.println("2等奖");
                    break;
                case 6:
                    System.out.println("小明1等奖");
                    break;
                case 7:
                    System.out.println("小明特等奖");
                    break;
            }

        }

    }
}
